﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

namespace NJL.Web
{
    public partial class LoginToSina : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session.Add("FromWebSiteCode", Request.QueryString["websitecode"]);
            Session.Add("FromDomain", Request.QueryString["domain"]);
            Session.Add("FromUrl", Request.QueryString["url"]);
            Session.Add("FromLoginType", Request.QueryString["logintype"]);

            oAuthSina oauth = new oAuthSina();
            oauth.RequestTokenGet();
            string url = oauth.AuthorizationGet();
            Session["oauth_token"] = oauth.token;
            Session["oauth_token_secret"] = oauth.tokenSecret;
            Response.Redirect(url + "&oauth_callback=" + System.Configuration.ConfigurationManager.AppSettings["SinaConsumerCallbackUrl"]);
        }
    }
}